package cn.js.controller;

import cn.js.dto.User;
import com.js.fegin.UserFeignClientApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Description:
 *
 * @Author Js
 * @Create 2024-11-23 22:52
 * @Version 1.0
 */
@RestController
@RequestMapping("/order")
public class ApiController {
    @Resource
    private UserFeignClientApi userFeignClientApi;



    @GetMapping("/getUserById/{id}")
    public User getUserById(@PathVariable Long id) throws InterruptedException {
        //通过 UserFeignClient Feign的客户端接来调用用户服务，获取User并返回，此时这样的写法才够优雅
        return userFeignClientApi.getByApiId(id);
    }
}
